package com.dorje.sys.service.impl;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dorje.sys.bean.MenuLeftBean;
import com.dorje.sys.dao.MenuDao;
import com.dorje.sys.entity.Menu;
import com.dorje.sys.service.MenuService;

@Service("menuService")
public class MenuServiceImpl extends BaseServiceImpl<Menu> implements MenuService  {
	
	@Autowired
	MenuDao menuDao;
	
	@Override
	public List<MenuLeftBean> findLeftMenu() {
		return menuDao.findLeftMenu(1) ;
	}

	@Override
	public Set<String> findPermissionsByUserId(Integer userId) {
		List<HashMap<String, String>> lists = menuDao.findPermissionsByUserId(userId);
		Set<String> set = new HashSet<String>();		
		for(HashMap<String, String> m:lists){
			set.add(m.get("page_url"));
		}
		return set;
	}
	
	
	
}
